<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/jsp/comm_css_include.jsp"%>
<!-- jqgrid-->
<link
	href="${basePath}/css/plugins/jqgriddemo/css/ui.jqgrid-bootstrap.min.css"
	rel="stylesheet" />
<!doctype html>
<html>
<head>
<style type="text/css">
* {
	margin: 0px;
	padding: 0px;
	font-size: 12px;
}
</style>
</head>
<body class="gray-bg">

	<!-- 隐藏域 -->
	<input type="hidden" value="${replaceId}" id="replaceId"
		name="replaceId" />
	<input type="hidden" value="${busiId}" id="busiId" name="busiId" />
	<input type="hidden" value="${modeId}" id="modeId" name="modeId" />
	<input type="hidden" value="${ywBusinessVo.queryCreditApplyId}"
		id="queryCreditApplyId" name="queryCreditApplyId" />
	<!-- 隐藏域 -->

	<div class="container creditbody">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;风控审核>财务审核二</span>
			<a href="javascript:void(0)"></a>
		</div>
		<div class="ibox-content ibox-con">
			<%@include file="/jsp/common_yw_with_loan_include.jsp"%>
		</div>
		<!-- 引入共有的页面 -->
		<%@include file="/jsp/fkshContent.jsp"%>

		<!-- <div class="business-man" id="" >主借人</div> -->
		<div id="outersp" class="clear-both">
			<ul id="tabmy">
				<li class="current">我的审批</li>
				<li>历史审批</li>
				<ul class="suoding">
					<li><div id="fkshsuo" class="fkshsuo" name="fkshsuo"
							onclick="fkshSuoDing();" title="解锁"></div></li>
				</ul>
			</ul>

			<div id="contentmy">
				<div class="ul-style" style="display: block;">
					<form class="form-horizontal business-form" id="">
						<div class="business-padding" id="">
							<ul class="myul">
								<li class="myul-lia np">审核详情：</li>
								<li class="myul-lib"><textarea id="audit_detail"
										name="audit_detail" rows="3" cols="" class="textarea-control"></textarea></li>
							</ul>

							<ul class="myul">
								<li class="myul-lia np">审核批注：</li>
								<li class="myul-lib">
									<div class="ibox-content no-padding">
										<div class="summernote2" id="audit_postil" name="audit_postil"></div>
									</div>
								</li>
							</ul>
							<ul class="myul">
								<li class="myul-lia np">加装GPS：</li>
								<li class="myul-lic"><input class="form-control"
									type="text" id="addGps_value_extras" name="addGps_value_extras"
									readonly="readonly" /></li>
								<li class="myul-lia np">加收押金：</li>
								<li class="myul-lic"><input class="form-control"
									type="text" id="addGeposit_value_extras"
									name="addGeposit_value_extras" readonly="readonly" /></li>
							</ul>
							<ul class="myul">
								<li class="myul-lia np">延迟垫款：</li>
								<li class="myul-lic" style="width: 360px;"><label><input
										type="checkbox" id="box_order" name="box_order" />垫款在银行放款后</label></li>
							</ul>
							<ul class="myul">
								<li class="myul-lia np">&nbsp</li>
								<li>
									<button type="button" class="btn dpbtn_green "
										onclick="approval('pass');">过审</button> <!--<button type="button" class="btn dpbtn_blue " onclick="approval('fail');">不过审</button>-->
								</li>
							</ul>

						</div>
					</form>
				</div>
				<div class="ul-style">
					<form class="form-horizontal business-form">
						<div class="business-padding" id="historical_approval"
							name="historical_approval">&nbsp;</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>

	<!-- summernote -->
	<%@include
		file="/js/common-dpqc/dpqc-summernote/comm_summernote_include.jsp"%>

	<!-- jqGrid -->
	<script type="text/javascript" charset="utf-8"
		src="${basePath}/js/plugins/jqgriddemo/js/jquery.jqGrid.min.js"></script>
	<script type="text/javascript" charset="utf-8"
		src="${basePath}/js/plugins/jqgriddemo/js/grid.locale-cn.min.js"></script>
	<!-- 
 	    作者：程立勇
 	   描述：js脚本
 	 -->
	<script type="text/javascript">
 	
	 	$(document).ready(function () {
	 		
	        $('#audit_postil').summernote({
	            lang: 'zh-CN',
	            toolbar:[
					['style', ['bold', 'italic', 'underline', 'clear']],
					['color', ['color']]
	            ]
	        });
	        var $limy = $('#tabmy>li');
			var $ulmy = $('#contentmy .ul-style');
	        $limy.click(function(){
				var $this = $(this);
				var $t = $this.index();
				$limy.removeClass();
				$this.addClass('current');
				$ulmy.css('display','none');
				$ulmy.eq($t).css('display','block');
			});
	        //初始加载
	        initData();
	    });
	 	
	 	//初始化
	 	var initData = function()
	 	{
	 		var busiId = $('#busiId').val();
	 		
	 		$.dpAjax({
	 			show:false,
		   		url:'${basePath}/FengKongShenHeController/getOtherAuditListVo',
		   		data:{
		   			"gps":"GPS",
		   			"busiId":busiId
		   		},
				success: function(datas){
			 	  if(datas.flag == "100100")
			 	  {
			 		  var d = datas.result;
			 		  
			 		  var content = '';
			 		 
			 		  for(var i=0;i<d.length;i++)
			 		  {
			 			  var audit_name = d[i].auditName
			 			  var org_name = d[i].orgName
			 			  var creator_name = d[i].creatorName;
			 			  var created = d[i].created;
			 			  var audit_postil = d[i].auditPostil;
			 			  
		 			      content += '<ul class="course-table">'
			 			  			  + '<li  class="rgb-color">'+audit_name+'</li>'
			 			  			  + '<li class="course-tablelib">'
			 			  			  	+ '<p class="course-time">'+org_name+' &nbsp; '+creator_name+' &nbsp;'+created+'</p>'
			 			  			  	+ audit_postil
			 			  			  + '</li>'
			 			  		  + '</ul>';
			 		  }
			 		  
			 		  $('#historical_approval').html(content);
			 		  
			 		  
			 		  //加装GPS  加收押金
			 		  var d = datas.gpsResult;
			 		  if(d && d.length > 0)
			 		  { 
			 			  for(var i=0;i<d.length;i++)
			 			  {
			 				  var b = d[i];
			 				  var type_extras = b.typeExtras;
			 				  var code_extras = b.codeExtras;
			 				  var value_extras = b.valueExtras
			 				  if(code_extras == "Audit" && type_extras == "AddGps")
			 				  {
			 					  $('#addGps_value_extras').val(value_extras);
			 				  }
			 				  else if(code_extras == "Audit" && type_extras == "AddGeposit")
			 				  {
			 					 $('#addGeposit_value_extras').val(value_extras);
			 				  }
			 				  else if(code_extras == "Audit" && type_extras == "IsSpecialOrder")
			 				  {
			 					  if(value_extras == "1")
			 					  {
			 						 document.getElementById("box_order").checked = true;
			 					  }
			 				  }
			 			  }
			 		  }
			 		  return;
				  }
				  if(datas.flag == "100200"){
					  alert(JSON.stringify(datas));
		              return;
		          }
				  layer.msg(datas.message, {icon: 2});
				}
		   	});
	 	}
	 	
	 	
	 	//过审
	 	var approval = function(event)
	 	{
	 		var replaceId = $('#replaceId').val();
	 		var busiId = $('#busiId').val();
	 		var modeId = $('#modeId').val();
	 		var audit_detail = $('#audit_detail').val();
	 		var audit_postil = $('#audit_postil').code();
	 		var org_code = '${current_user_key.orgId}';
	 		var org_name = '${current_user_key.orgName}';
	 		
	 		//询问框
	 		layer.confirm('审核就绪，是否确认执行？操作人：<span style="color:#BD1723;">${current_user_key.uname}</span>', {
	 		  btn: ['确定','取消'] //按钮
	 		}, function(){
	 			layer.msg('正在进入，请稍后...',{icon: 16,shade: 0.15});
	 			layer.closeAll();
	 			$.dpAjax({
	 				show:false,
		 			url:'${basePath}/FengKongShenHeController/examineImplement',
		 			data:{
		 				"id":replaceId,
		 				"busiId":busiId,
		 				"modeId":modeId,
		 				"auditDetail":audit_detail,
		 				"auditPostil":audit_postil,
		 				"orgCode":org_code,
		 				"orgName":org_name
		 			},
		 			success: function(datas)
		 			{
		 				  if(datas.flag == "100100")
		 				  {
		 					  layer.msg('审核执行成功！', {icon: 6});
		 					  setTimeout(function () {
		 						 window.location.href = "${basePath}/web/fengKongShenHe/fkshCwsheList.jsp";
		 					  }, 3000);
		 					  return;
		 				  }
		 				  if(datas.flag == "100200")
		 				  {
		 					  alert(JSON.stringify(datas));
		 					  return;
		 				  }
		 				  layer.msg(datas.message, {icon: 5});
		 		     }
		 		});
	 			
	 		}, function(){
	 			layer.msg('已取消本次操作！', {icon: 6});
	 		});
	 	}
	 	
	 	
	 	//解锁
	 	var num=1;
	 	var fkshSuoDing = function()
	 	{
 		  if(num == 1)
 		  {  
	 			//询问框
		 		layer.confirm('是否要执行解锁操作？操作人：<span style="color:#BD1723;">${current_user_key.uname}</span>', {
		 		  btn: ['确定','取消'] //按钮
		 		}, function(){
		 			layer.closeAll();
		 			var replaceId = $('#replaceId').val();
		 			$.dpAjax({
		 				show:false,
			 			url:'${basePath}/FengKongShenHeController/fengKongShenHeJieSuo',
			 			data:{
			 				"replaceId":replaceId
			 			},
			 			success: function(datas)
			 			{
			 				  if(datas.flag == "100100")
			 				  {		
			 			 		  $("#fkshsuo").css("background",'url(../img/lock-open-icon.png)')
			 					  layer.msg("当前审核数据解锁成功！", {icon: 6});
			 					  num++;
			 					  return;
			 				  }
			 				  if(datas.flag == "100200")
			 				  {
			 					  alert(JSON.stringify(datas));
			 					  return;
			 				  }
			 				  layer.msg(datas.message, {icon: 5});
			 		     }
			 		});
		 		}, function(){
		 			layer.msg('已取消本次操作！', {icon: 6});
		 		});
 			}
 		  else
 		  {
 			 layer.msg("已经解锁,无需再次解锁！", {icon: 5});
 			 return;
 		  } 
	 	}
</script>
</body>
</html>
